package main

import (
	"time"

	"monitor/models"
	_ "monitor/routers"

	"github.com/astaxie/beego"
)

func main() {

	beego.SetStaticPath("/static", "static")
	go Gc()

	beego.EnableGzip = true
	beego.Run()
}

func Gc() {
	gcTime, _ := beego.AppConfig.Int("gc.time")
	timer := time.NewTicker(time.Duration(gcTime) * time.Second)
	for {
		select {
		case <-timer.C:
			models.Gc()
		}
	}
}
